<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"%>
<%
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ request.getContextPath();
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
 		<link rel="stylesheet" type="text/css" href="<%=basePath %>/css/updateVideo.css" />
        <link rel="stylesheet" href="<%=basePath %>/css/list.css">
		<link href="<%=basePath %>/css/H-ui.min.css" rel="stylesheet" type="text/css" />
		<link href="<%=basePath %>/css/formsCSS.css" rel="stylesheet" type="text/css" />
		<script src="<%=basePath%>/lib/My97DatePicker/WdatePicker.js"></script>
		<script src="<%=basePath %>/js/jquery.min.js"></script>
		<script src="<%=basePath %>/js/formsJS.js"></script>

<script type="text/javascript">

function checkForm(f){

	if(f.indexTypeCode.value.replace(/\s/g,'') == ''){
		alert("分类名称不能为空");
		return false;
	}
 
	return true;
}

//选中下拉框选择的值
function choice(){
	var goodsSort = document.getElementById('goodsSort').value.trim();   
	 if(goodsSort==1){
   		 $("#courseId").show();
   		 $("#chapterId").hide();
   		 $("#cardId").hide();
   		 $("#goodsId").hide();
   	 }else if(goodsSort==2){
   		 $("#courseId").hide();
   		 $("#chapterId").show();
   		 $("#cardId").hide();
   		 $("#goodsId").hide();
   	 }else if(goodsSort==3){
   		 $("#courseId").hide();
   		 $("#chapterId").hide();
   		 $("#cardId").show();
   		 $("#goodsId").hide();
   	 }else{
   		 $("#courseId").hide();
   		 $("#chapterId").hide();
   		 $("#cardId").hide();
   		 $("#goodsId").show();
   	 } 
	
}

</script>
</head>
<body>
		<div class="connect_wrap">
    		<h3 style= "text-align: center;">课程分类维护</h3>
			<div class="row cl" style="max-width:88%;margin-left:8%;">
			<div class="labelText"></div>
				<form action="<%=basePath%>/goodsOrderRelation/goodsOrderRelationEdit" method="post" onsubmit="return checkForm(this)"
					enctype="multipart/form-data">
					<div class="col-sm-4"></div>
	    					<div class="col-sm-4">
	    							<div class="boxs">
												<input type="hidden" name="id" value="${goodsOrderRelation.id}">
												<input type="text" class="inputBox" placeholder="订单编号" name="orderCode" value="${goodsOrderRelation.orderCode}" readOnly="readonly" >
												<input type="text" class="inputBox" placeholder="商品数量" name="goodsCount" value="${goodsOrderRelation.goodsCount}" >
												<input type="text" class="inputBox" placeholder="商品价格" name="goodsPrice" value="${goodsOrderRelation.goodsPrice}" >
												
												  <select id="saleFlag" name="saleFlag" class="selectBox"  >
												  	<option value="">是否秒杀</option>
												  	<option value="0" ${goodsOrderRelation.saleFlag == 0 ? 'selected="selected"' : '' }>否</option>
										  			<option value="1" ${goodsOrderRelation.saleFlag == 1 ? 'selected="selected"' : '' }>是</option>
												</select>
												
											     <select id="goodsSort" name="goodsSort" class="selectBox" onchange="choice()" >
												  	<option value="">商品分类</option>
												  	<option value="1" ${goodsOrderRelation.goodsSort == 1 ? 'selected="seelcted"' : '' }>课程</option>
										  			<option value="2" ${goodsOrderRelation.goodsSort == 2 ? 'selected="seelcted"' : '' }>章节</option>
										  			<option value="3" ${goodsOrderRelation.goodsSort == 3 ? 'selected="seelcted"' : '' }>年卡</option>
										  			<option value="4" ${goodsOrderRelation.goodsSort == 4 ? 'selected="seelcted"' : '' }>商品</option>
												</select>
												 
												
												<select class="selectBox" name="courseId" id="courseId">
								    				<option value="-1">----选择课程----</option>
									    			<c:forEach items="${courses}" var="c">
									    				<option value="${c.id}" ${c.id == goodsOrderRelation.courseId ? 'selected="selected"' : ''}>${c.id}:${c.courseName}</option>
									    			</c:forEach>
					    						</select>
					    						
					    						<select class="selectBox" name="chapterId" id="chapterId">
								    				<option value="-1">----选择章节----</option>
									    			<c:forEach items="${chapters}" var="c">
									    				<option value="${c.id}" ${c.id == goodsOrderRelation.chapterId ? 'selected="selected"' : ''}>${c.id}:${c.chapterName}</option>
									    			</c:forEach>
					    						</select>
					    						
					    						<select class="selectBox" name="cardId" id="cardId">
								    				<option value="-1">----选择vip卡----</option>
									    			<c:forEach items="${cards}" var="c">
									    				<option value="${c.id}" ${c.id == goodsOrderRelation.cardId ? 'selected="selected"' : ''}>${c.id}:${c.cardName}</option>
									    			</c:forEach>
					    						</select>
					    						<select class="selectBox" name="goodsId" id="goodsId">
								    				<option value="">----选择商品----</option>
									    			<c:forEach items="${goods}" var="g">
									    				<option value="${g.id}" ${g.id == goodsOrderRelation.goodsId ? 'selected="selected"' : ''}>${g.id}:${g.goodsName}</option>
									    			</c:forEach>
					    						</select>
					    						 
					    						 <input type="text" class="inputBox" placeholder="商品规格" name="specification" value="${goodsOrderRelation.specification}" >
					    						 
												<select id="saleFlag" name="saleFlag" class="selectBox"  >
												  	<option value="">是否评价</option>
												  	<option value="1" ${goodsOrderRelation.saleFlag == 1 ? 'selected="selected"' : '' }>是</option>
										  			<option value="2" ${goodsOrderRelation.saleFlag == 2 ? 'selected="selected"' : '' }>否</option>
												</select>
					    						
					    						
												<input type="submit" value="确定" class="true" />
												<input type="button"  class="false" value="取消" onclick="window.history.go(-1)">
										</div>
								</div>
					</form>
			</div>
	</div>
	
</body>
<script>

$(function(){
	var goodsSort = document.getElementById('goodsSort').value.trim();   
	if(goodsSort==1){
  		 $("#courseId").show();
  		 $("#chapterId").hide();
  		 $("#cardId").hide();
  		 $("#goodsId").hide();
  	 }else if(goodsSort==2){
  		 $("#courseId").hide();
  		 $("#chapterId").show();
  		 $("#cardId").hide();
  		 $("#goodsId").hide();
  	 }else if(goodsSort==3){
  		 $("#courseId").hide();
  		 $("#chapterId").hide();
  		 $("#cardId").show();
  		 $("#goodsId").hide();
  	 }else{
  		 $("#courseId").hide();
  		 $("#chapterId").hide();
  		 $("#cardId").hide();
  		 $("#goodsId").show();
  	 } 
	
	 
});

</script>
  
	    		
	    	
	 
</html>